import { postService } from '.'
import { PORT1 } from '../config/net.config'
import { postServiceList } from './index'
import { Procure } from './interface/procure'

// 获取退货/入库单
export const getRejectionListAPI = (params: {}) => {
  return postService<Array<Procure.Rejection>>(`${PORT1}/CoreCmsStockin/GetPageList`, params, 'form')
}
// 获取退货单详细
export const getRejectionDetailAPI = (params: {}) => {
  return postService<Procure.RejectionDetail>(`${PORT1}/CoreCmsStockin/GetEdit`, params, 'json')
}
// 新增退货单
export const addRejectionAPI = (params: Procure.RejectionDetail) => {
  return postService<null>(`${PORT1}/CoreCmsStockin/DoCreate`, params, 'json')
}
// 编辑退货单
export const editRejectionAPI = (params: Procure.RejectionDetail) => {
  return postService<null>(`${PORT1}/CoreCmsStockin/DoEdit`, params, 'json')
}
// 审核
export const checkRejectionAPI = (params: Procure.RejectionDetail) => {
  return postService<null>(`${PORT1}/corecmsstockin/Confirm`, params, 'json')
}
// 删除
export const deleteWareHouseAPI = (params: Procure.RejectionDetail) => {
  return postService<null>(`${PORT1}/corecmsstockin/DoDelete`, params, 'json')
}
// 反审核
export const unCheckWareHouseAPI = (params: Procure.RejectionDetail) => {
  return postService<null>(`${PORT1}/CoreCmsStockin/DoCancel`, params, 'json')
}
// 仓库列表
export const getStoreHouseAPI = (params: {}) => {
  return postServiceList<Procure.StoreHouse>(`${PORT1}/CoreCmsStorehouse/GetPageList`, params, false)
}
// 库存资料
export const getGoodsTotalAPI = (params: {}) => {
  return postServiceList<Procure.GoodsTotal>(`${PORT1}/CoreCmsGoodTotal/GetPageList`, params, false)
}
// 库存流水
export const getStockStatementAPI = (params: {}) => {
  return postServiceList<Procure.StockStatement>(`${PORT1}/corecmsinventoryflow/GetPageList`, params, false)
}
// 盘点计划
export const getStockPlanAPI = (params: {}) => {
  return postServiceList<Procure.StockPlan>(`${PORT1}/corecmsinventoryplan/GetPageList`, params, false)
}
// 新增盘点计划
export const createStockPlanAPI = (params: {}) => {
  return postService<null>(`${PORT1}/corecmsinventoryplan/DoCreate`, params, 'json')
}
// 编辑盘点计划
export const editStockPlanAPI = (params: {}) => {
  return postService<null>(`${PORT1}/corecmsinventoryplan/DoEdit`, params, 'json')
}
// 删除盘点计划
export const deleteStockPlanAPI = (params: {}) => {
  return postService<null>(`${PORT1}/corecmsinventoryplan/DoDelete`, params, 'json')
}
// 审核盘点计划
export const checkStockPlanAPI = (params: {}) => {
  return postService<null>(`${PORT1}/corecmsinventoryplan/DoCheck`, params, 'json')
}
// 获取盘点计划数据
export const getStockPlanEditAPI = (params: {}) => {
  return postService<Procure.StockPlan>(`${PORT1}/corecmsinventoryplan/GetEdit`, params, 'json')
}
// 获取盘点计划详细商品
export const getStockPlanGoodsDetailAPI = (params: {}) => {
  return postServiceList<Procure.StockPlanGoodsDetail>(`${PORT1}/corecmsinventoryplan/GetDetailPageList`, params, false)
}
// 获取盘点计划商品列表
export const getStockPlanGoodsListAPI = (params: {}) => {
  return postServiceList<Procure.GetStockPlanGoodsList>(`${PORT1}/CoreCmsGoods/GetInventorProductPageList`, params, false)
}
// 盘点单列表
export const getStockRealSheetAPI = (params: {}) => {
  return postServiceList<Procure.StockRealSheet>(`${PORT1}/corecmsinventory/GetPageList`, params, false)
}
// 新增
export const createStockRealSheetAPI = (params: {}) => {
  return postService<null>(`${PORT1}/corecmsinventory/DoCreate`, params, 'json')
}
// 详细
export const createStockRealSheetDetailAPI = (params: {}) => {
  return postService<Procure.StockRealSheet>(`${PORT1}/corecmsinventory/GetEdit`, params, 'json')
}
// 编辑
export const editStockRealSheetAPI = (params: {}) => {
  return postService<null>(`${PORT1}/corecmsinventory/DoEdit`, params, 'json')
}
// 删除
export const deleteStockRealSheetAPI = (params: {}) => {
  return postService<null>(`${PORT1}/corecmsinventory/DoDelete`, params, 'json')
}
// 审核
export const checkStockRealSheetAPI = (params: {}) => {
  return postService<null>(`${PORT1}/corecmsinventory/DoCheck`, params, 'json')
}

// 报损单
// 列表
export const getStockOutListAPI = (params: {}) => {
  return postServiceList<Procure.BreakageSheet>(`${PORT1}/CoreCmsStockOut/GetPageList`, params, false)
}
// 新增
export const createStockOutAPI = (params: {}) => {
  return postService<null>(`${PORT1}/CoreCmsStockOut/DoCreate`, params)
}
// 删除
export const deleteStockOutAPI = (params: {}) => {
  return postService<null>(`${PORT1}/CoreCmsStockOut/DoDelete`, params)
}
// 获取资料
export const getStockOutAPI = (params: {}) => {
  return postService<Procure.BreakageResult>(`${PORT1}/CoreCmsStockOut/GetEdit`, params)
}
// 编辑资料
export const editStockOutAPI = (params: {}) => {
  return postService<null>(`${PORT1}/CoreCmsStockOut/DoEdit`, params)
}
// 审核
export const checkStockOutAPI = (params: {}) => {
  return postService<null>(`${PORT1}/CoreCmsStockOut/DoCheck`, params)
}
// 反审核
export const unCheckStockOutAPI = (params: {}) => {
  return postService<null>(`${PORT1}/CoreCmsStockOut/DoCancel`, params)
}
// 导出
export const exportStockOutAPI = (params: {}) => {
  return postService<null>(`${PORT1}/CoreCmsStockOut/DoExport`, params)
}

// 报损原因 通用类型
export const getBreakageResultAPI = (params: {}) => {
  return postServiceList<Procure.BreakageResult>(`${PORT1}/CoreCmsCustom/GetPageList`, params, false)
}
// 新增
export const createBreakageResultAPI = (params: {}) => {
  return postService<null>(`${PORT1}/CoreCmsCustom/DoCreate`, params, 'json')
}
export const editBreakageResultAPI = (params: {}) => {
  return postService<null>(`${PORT1}/CoreCmsCustom/DoEdit`, params, 'json')
}
export const deleteBreakageResultAPI = (params: { id: number[] }) => {
  return postService<null>(`${PORT1}/CoreCmsCustom/DoDelete`, params, 'json')
}

// 采购单
export const getProcureSheetAPI = (params: {}) => {
  return postServiceList<Procure.ProcureSheet>(`${PORT1}/CoreCmsPurchase/GetPageList`, params, false)
}
export const createProcureSheetAPI = (params: {}) => {
  return postService<null>(`${PORT1}/CoreCmsPurchase/DoCreate`, params, 'json')
}
export const editProcureSheetAPI = (params: {}) => {
  return postService<null>(`${PORT1}/CoreCmsPurchase/DoEdit`, params, 'json')
}
export const getProcureSheetDetailAPI = (params: { id: number | string; isRelation?: number }) => {
  return postService<Procure.ProcureSheetDetail>(`${PORT1}/CoreCmsPurchase/GetEdit`, params, 'json')
}
export const deleteProcureSheetAPI = (params: {}) => {
  return postService<null>(`${PORT1}/CoreCmsPurchase/DoDelete`, params, 'json')
}
// 审核采购单
export const checkProcureSheetAPI = (params: {}) => {
  return postService(`${PORT1}/CoreCmsPurchase/DoCheck`, params, 'json')
}
// 反审核采购单
export const cancelCheckProcureSheetAPI = (params: {}) => {
  return postService(`${PORT1}/CoreCmsPurchase/CancelCheck`, params, 'json')
}

//
export const getProcureWarehouseTotalAPI = (params: {}) => {
  return postServiceList<Procure.ProcureWarehouseTotalDetail>(`${PORT1}/corecmsstockin/GetPurchaseSummary`, params, false)
}

// 新增
export const getAdjustmentReasonAPI = (params: {}) => {
  return postServiceList<Procure.AdjustmentReason>(`${PORT1}/CoreCmsFoodTag/GetPageList`, params, false)
}
export const createAdjustmentReasonAPI = (params: {}) => {
  return postService<null>(`${PORT1}/CoreCmsFoodTag/DoCreate`, params, 'json')
}
export const editAdjustmentReasonAPI = (params: {}) => {
  return postService<null>(`${PORT1}/CoreCmsFoodTag/DoEdit`, params, 'json')
}
export const deleteAdjustmentReasonAPI = (params: { id: number[] }) => {
  return postService<null>(`${PORT1}/CoreCmsFoodTag/DoDelete`, params, 'json')
}
